package cn.enilu.flash.bean.entity.task;

import cn.enilu.flash.bean.entity.BaseEntity;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.Table;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

@Entity(name = "t_money_info")
@Table(appliesTo = "t_money_info", comment = "账户变动明细")
@Data
@EntityListeners(AuditingEntityListener.class)
public class MoneyInfo{
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @CreationTimestamp
    @Column(name = "create_time", columnDefinition = "DATETIME COMMENT '创建时间/注册时间'", updatable = false)
    private Date createTime;
    @Column(name = "create_by", columnDefinition = "bigint COMMENT '创建人'", updatable = false)
    private Long createBy;
    @UpdateTimestamp
    @Column(name = "modify_time", columnDefinition = "DATETIME COMMENT '最后更新时间'")
    private Date modifyTime;
    @LastModifiedBy
    @Column(name = "modify_by", columnDefinition = "bigint COMMENT '最后更新人'")
    private Long modifyBy;
    @Column( columnDefinition = "VARCHAR(30) COMMENT '明细说明'")
    private String moneyExplain;
    @Column(columnDefinition = "decimal(10,2) COMMENT '金额'")
    private BigDecimal money;
    @Column( columnDefinition = "tinyint COMMENT '类型：1任务奖励，2余额提现，3任务支付，4任务退款,5余额充值'")
    private Integer type;
    @Column(columnDefinition = "bigint COMMENT '任务ID'")
    private Long taskId;
    @Column(columnDefinition = "decimal(10,2) COMMENT '变动前金额'")
    private BigDecimal beforeMoney;
    @Column(columnDefinition = "decimal(10,2) COMMENT '变动后金额'")
    private BigDecimal afterMoney;
}
